#if !defined(__DATE_H)
#    define __DATE_H

#    include <string>
#    include <time.h>
#    include <unistd.h>
#    include <iostream>

class Date;

namespace http {
    namespace date {
        class Seconds;

        class Seconds {
            friend Date;
            friend std::ostream &operator<<(std::ostream &os, Seconds s);

        private:
            time_t seconds;

        public:
            Seconds(const time_t _seconds) {
                this->seconds = _seconds;
            }
            ~Seconds() {}
        };

        class Date {
        private:
            time_t m_time;

            tm m_tm;

        public:
            static Date now() {
                // time_t _m_time;
                // time(&_m_time);
                return time(NULL);
            }

            std::string toString(std::string format = "%c");

            Seconds toSeconds() { return m_time; };

            time_t toTimeT() { return m_time; };

            Date(){};
            ~Date(){};

            Date(const time_t _seconds) {
                this->m_time = _seconds;
            }
            Date(std::string date);

        public:
            Date operator+(const time_t &_seconds) {
                return this->m_time + _seconds;
            }

            Date operator-(const time_t &_seconds) {
                return this->m_time - _seconds;
            }

            Date operator-(const Date &_seconds) {
                return this->m_time - _seconds.m_time;
            }

            bool operator>(const Date &date) {
                return this->m_time > date.m_time;
            }

            bool operator<(const Date &date) {
                return this->m_time < date.m_time;
            }

            bool operator==(const Date &date) {
                return this->m_time == date.m_time;
            }
        };
    }  // namespace date

}  // namespace http

#endif  // __RD_DATE_H
